<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>服装库存监控</title>
<jsp:include page="/common.jsp" />
</head>

<body>
	<table cellpadding="0" cellspacing="0" width="100%" height="100%">
		<tbody>
			<tr>
				<td>
					<div class="toolbar" style="background-color: #e0e0e0;">
					<!-- 	<a plain="true" href="javascript:void(0);"
							class="easyui-linkbutton" iconCls="icon-add" onclick="toDo(options,'C');">新增</a> -->
						&nbsp;&nbsp;库存警戒数:&nbsp;<input type="text" value="10" name="monitor_count" id="monitor_count"/>
						<!-- <a plain="true" href="javascript:void(0);"
							class="easyui-linkbutton" iconCls="icon-save" onclick="toDo(options,'M');">编辑</a>
						<a plain="true" href="javascript:void(0);"
							class="easyui-linkbutton" iconCls="icon-remove" onclick="toDo(options,'R');">删除</a>
						<a plain="true" href="javascript:void(0);" 
							class="easyui-linkbutton" iconCls="icon-save" onclick="assign();">分配</a> -->
					</div>
				</td>
			</tr>
			
			<tr>
				<td height="100%" valign="top" width="100%">
					<table id="lister" name="lister" style="width:100%;height:100%"></table>
					<div id="pager"></div>
				</td>
			</tr>
		</tbody>
	</table>
	<div id='win' class='easyui-window' title='New Window' style='width:400px;height:300px;padding:5px;' closed='true'>
	</div>
	<script>
	function getCount(){
		return $("#monitor_count").val();
	}
	
     $(document).ready(function(){
    	 $("#lister")
			.jqGrid(
					{
						url : "${pageContext.request.contextPath }/system/monitor/monitorBy.htm",
						datatype : "json",
						colNames : [ '编号', '仓库名称'],
						colModel : [ 
									{name : 'id',index : 'ware_id',width : 200}, 
									{name : 'wareName',index : 'ware_name',width : 450}
									],
						rowNum : 20,
						shrinkToFit: true,
						rowList : [ 10, 20, 30 ],
						pager : '#pager',
						sortname : 'ware_id',
						viewrecords : true,
						sortorder : "asc",
						mtype: "POST",
						autowidth:true,
						subGrid: true,
						height: '100%',
						width:'90%',
						subGridOptions: { "plusicon" : "ui-icon-triangle-1-e", "minusicon" : "ui-icon-triangle-1-s", "openicon" : "ui-icon-arrowreturn-1-e" },
						
						
						
						subGridRowExpanded: function(subgrid_id, row_id) { 
							var subgrid_table_id, pager_id; 
							subgrid_table_id = subgrid_id+"_t"; 
							pager_id = "p_"+subgrid_table_id; 
							$("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>"); 
							jQuery("#"+subgrid_table_id).jqGrid(
									{ 
										url:"${pageContext.request.contextPath }/system/monitor/monitorCountBy.htm?monitorCount="+getCount()+"&id="+row_id, 
										datatype: "json", 
										colNames: ['仓库编号','服装编号','服装名称','服装库存数量'], 
										colModel: [ 
										            {name:"ware_id",index:"ware_id",width:80,hidden:true}, 
										            {name:"eep.product_id",index:"eep.product_id",width:130,searchtype:"integer"}, 
										            {name:"product_name",index:"product_name",width:200}, 
										            {name:"product_count",index:"product_count",width:100,searchtype:"number"}, 
										            ], 
										rowNum : 10,
										shrinkToFit: true,
										rowList : [ 10, 20, 30 ],
										pager: pager_id, 
										sortname: 'eep.product_id', 
										sortorder: "asc", 
										viewrecords : true,
										width:'90%',
										height: '100%' 
									}); 
							$("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:false,add:false,del:false});
						}
					});
		$("#lister").jqGrid('navGrid','#pager', {edit : false,add : false,del : false});
      });
	</script>
</body>
</html>